//
//  EquipmentManagerController.m
//  PropertyMananger
//
//  Created by bh on 17/2/8.
//  Copyright © 2017年 BH. All rights reserved.
//

#import "EquipmentManagerController.h"
#import "EquipmentManagerCell.h"
#import "EquipmentQueryController.h"
#import "EquipmentRepairController.h"
#import "MaintenanceController.h"

@interface EquipmentManagerController ()
/**图片数据源**/
@property (nonatomic,strong) NSArray * mImgArr;
/**标题数据源**/
@property (nonatomic,strong) NSArray * mTitleArr;
@end

@implementation EquipmentManagerController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    
     [self initTitleViewName:@"设备管理"];
    
    [self initTableViewWithView:self.view frame:CGRectMake(0, 0, BHscreenW, BHscreenH) isGroup:NO];
    self.tableView.backgroundColor = BHGrayColor;
    [self initData];
}

#pragma makr - 数据源
- (void)initData
{
    //icon
    self.mImgArr = @[@"ico_equipment_query",@"ico_work_order_repair",@"ico_equipment_maintenance"];
    //标题
    self.mTitleArr = @[@"设备查询",@"设备检修",@"保养计划"];
    
}
#pragma mark - 代理方法
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    
    return self.mImgArr.count;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{

    EquipmentManagerCell * cell = [EquipmentManagerCell cellWithTableView:tableView];
    
    cell.iconImg.image = IMG(self.mImgArr[indexPath.row]);
    cell.titleLabel.text = self.mTitleArr[indexPath.row];
    
    return cell;

}
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{

    return 45;

}
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{

    if (indexPath.row == 0) {
        
        EquipmentQueryController * equipmentQueryVC = [[EquipmentQueryController alloc]init];
        
        [self.navigationController pushViewController:equipmentQueryVC animated:YES];
    }else if (indexPath.row == 1){
    
        EquipmentRepairController * repairVC = [[EquipmentRepairController alloc]init];
        
        [self.navigationController pushViewController:repairVC animated:YES];
    
    }else if (indexPath.row == 2){
    
        MaintenanceController * maintenanceVC = [[MaintenanceController alloc]init];
        
        [self.navigationController pushViewController:maintenanceVC animated:YES];
    
    }

}
@end
